package com.rankeiot.core.translator;

public class ChainTranslator implements Translator {
    Translator[] translators;
   public ChainTranslator(Translator... translators){
       this.translators=translators;
   }

    @Override
    public Object translate(Object target, String filedName, Object value) {
       //遍历所有的translator，直到找到一个可以处理的translator
        Object result = value;
        for (Translator translator : translators) {
            result = translator.translate(target, filedName, result);
        }
        return result;
    }
}
